package systems;

import general.Perlin;
import geometry.PlanetVar;
import geometry.Zone;
import graphique.C;

import java.util.ArrayList;

public class AtmoSystem
{
	public ArrayList<Nuage> lNuage = new ArrayList<Nuage>();

	public void creationNuage(int taille, int it, int jt , float alt )
	{
		Nuage nuage = new Nuage( taille , taille , alt );
		
		nuage.g = Perlin.conversionCentree( nuage.g , it , jt );
		
		nuage.g = Perlin.normaliser( nuage.g );
		
		lNuage.add( nuage );
	}

	public void developpementNuage(PlanetVar pl )
	{	
		for( int i = 0 ; i < lNuage.size() ; i++ )
		{
			ArrayList<Zone> a = pl.creationZonesB( lNuage.get(i).g , 1 , lNuage.get(i).g.length/2 );
			
			ArrayList<Zone> am = new ArrayList<Zone>();
			
			for( int j = 0 ; j < a.size() ;j++ )
			{
				if( a.get(j).p1.alt < C.seuilT || a.get(j).p2.alt < C.seuilT ||a.get(j).p3.alt < C.seuilT ||a.get(j).p4.alt < C.seuilT )
				{
					am.add( a.get(j) );
				}
			}
			
			System.out.println("Taille a : " + a.size());
			System.out.println("On enleve : " + am.size());
			
			a.removeAll(am);
			System.out.println("Taille a : " + a.size());
			
			lNuage.get(i).a = a;
		}
	}
}
